#ifndef __LIBNNET__
#define __LIBNNET__


#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <string.h>


#define NNET_ERROR_MAKE_TCP_SERVER_SOCKET 1
#define NNET_ERROR_CREATE_TCP_SELECT_SERVER 2

// request handler
typedef struct
{
  // function to call after accept
  int   (*handler)(void *, int);
  // parameter to give to the called function
  void  *params;
} nnetrqsth_t;


int     nnet_make_tcp_server_socket(uint16_t port);
int     nnet_create_tcp_select_server(int port
                                      , nnetrqsth_t *request_handler);



#endif


